package com.ybb.production.service.impl;

import com.yubb.common.utils.DateUtils;
import com.ybb.production.domain.GarmentProductionProcessConfig;
import com.ybb.production.mapper.GarmentProductionProcessConfigMapper;
import com.ybb.production.service.IGarmentProductionProcessConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 工序配置Service业务层处理
 *
 * @author dengjie
 * @date 2023-09-14
 */
@Service
public class GarmentProductionProcessConfigServiceImpl implements IGarmentProductionProcessConfigService {
    @Autowired
    private GarmentProductionProcessConfigMapper garmentProductionProcessConfigMapper;

    /**
     * 查询工序配置
     *
     * @param id 工序配置主键
     * @return 工序配置
     */
    @Override
    public GarmentProductionProcessConfig selectGarmentProductionProcessConfigById(Long id) {
        return garmentProductionProcessConfigMapper.selectGarmentProductionProcessConfigById(id);
    }

    /**
     * 查询工序配置列表
     *
     * @param garmentProductionProcessConfig 工序配置
     * @return 工序配置
     */
    @Override
    public List<GarmentProductionProcessConfig> selectGarmentProductionProcessConfigList(GarmentProductionProcessConfig garmentProductionProcessConfig) {
        return garmentProductionProcessConfigMapper.selectGarmentProductionProcessConfigList(garmentProductionProcessConfig);
    }

    /**
     * 新增工序配置
     *
     * @param garmentProductionProcessConfig 工序配置
     * @return 结果
     */
    @Override
    public int insertGarmentProductionProcessConfig(GarmentProductionProcessConfig garmentProductionProcessConfig) {
                garmentProductionProcessConfig.setCreateTime(DateUtils.getNowDate());
            return garmentProductionProcessConfigMapper.insertGarmentProductionProcessConfig(garmentProductionProcessConfig);
    }

    /**
     * 修改工序配置
     *
     * @param garmentProductionProcessConfig 工序配置
     * @return 结果
     */
    @Override
    public int updateGarmentProductionProcessConfig(GarmentProductionProcessConfig garmentProductionProcessConfig) {
                garmentProductionProcessConfig.setUpdateTime(DateUtils.getNowDate());
        return garmentProductionProcessConfigMapper.updateGarmentProductionProcessConfig(garmentProductionProcessConfig);
    }

    /**
     * 批量删除工序配置
     *
     * @param ids 需要删除的工序配置主键
     * @return 结果
     */
    @Override
    public int deleteGarmentProductionProcessConfigByIds(Long[] ids) {
        return garmentProductionProcessConfigMapper.deleteGarmentProductionProcessConfigByIds(ids);
    }

    /**
     * 删除工序配置信息
     *
     * @param id 工序配置主键
     * @return 结果
     */
    @Override
    public int deleteGarmentProductionProcessConfigById(Long id) {
        return garmentProductionProcessConfigMapper.deleteGarmentProductionProcessConfigById(id);
    }
}
